function [filename_out, variable_name] = save( session ) 
%SAVE �˴���ʾ�йش˺�����ժҪ
%   �˴���ʾ��ϸ˵��
    
    timestamp = datestr( session.start_time,  'yyyymmdd_hhMMss' );
    filename_out = [timestamp '_' session.session_owner ...
                              '_' session.session_name ...
                              '_' session.repository_revision(1:5) '.mat'];
    variable_name = ['session_' timestamp];
    eval(['session_' timestamp '= session;']);
    
    try
        if ispc
            save([Constant.AutoMeasurementAppPath '\DataTemporaryStorage\data\' filename_out], variable_name);
        elseif ismac
            save([Constant.AutoMeasurementAppPath '/DataTemporaryStorage/data/' filename_out], variable_name);
        end
    catch
        filename_out = [timestamp '_' session.session_owner ...
                              '_' session.session_name ...
                              '_' session.repository_revision(1:5) ...
                              datestr(now,  'yyyymmdd_hhMMss' ) '.mat'];

        if ispc
            save([Constant.AutoMeasurementAppPath '\DataTemporaryStorage\data\' filename_out], variable_name);
        elseif ismac
            save([Constant.AutoMeasurementAppPath '/DataTemporaryStorage/data/' filename_out], variable_name);
        end
    end
    
    L=log4m.getLogger;
    L.info('MeasurementSession::save', sprintf('Data saved in file %s.', filename_out));

end
